<div id="center_tieude">
  <img class="hinhds" src="./Picture/sp moi.jpg"   />
  <h3>Sản Phẩm Mới</h3>        
</div> <!--end center_tieude-->

<div id="center_noidung"> 
<?php
	if(isset($_GET['trang']))
	{
	$page=$_GET['trang'];
	$arr=sanpham::GetSanPham($page,12);
	for($i=0;$i<count($arr);$i++)     
	{    
	?>  	
  <div class="product">             
      <p class="new"><img src="./Picture/new san pham.png"/></p>
      <p class="img">
          <a href="./index.php?obj=sanpham&chitiet=<?php echo $arr[$i]->idSanPham;?>">
              <img src="<?php echo $arr[$i]->Hinh;?>" title="<?php echo $arr[$i]->Ten;?>" />
          </a>
      </p>
      <p class="pname">
          <?php echo $arr[$i]->Ten;?>
      </p>
      <p><b>Công ty:<?php echo $arr[$i]->Gia;?>đ</b></p>
      <p class="gift"></p>
  </div>  
  <?php
	}
	}
	else
		if(!isset($_GET['trang']))
		{
			$page=1;
			$arr=sanpham::GetSanPham($page,12);
			for($i=0;$i<count($arr);$i++)     
			{    
			?>  	
		  <div class="product">             
			  <p class="new"><img src="./Picture/new san pham.png"/></p>
			  <p class="img">
				  <a href="./index.php?obj=sanpham&chitiet=<?php echo $arr[$i]->idSanPham;?>">
					  <img src="<?php echo $arr[$i]->Hinh;?>" title="<?php echo $arr[$i]->Ten;?>" />
				  </a>
			  </p>
			  <p class="pname">
				  <?php echo $arr[$i]->Ten;?>
			  </p>
			  <p><b>Công ty:<?php echo $arr[$i]->Gia;?>đ</b></p>
			  <p class="gift"></p>
		  </div>  
          <?php
			}
		}
	?>
</div>
<div id="trang">
	<?php
		if(!isset($_GET["trang"]))
			$_GET["trang"]=1;
		if(isset($_GET["obj"]) && ($_GET["obj"]=='sanpham'||$_GET["obj"]=='trangchu'))
		{
		$a = sanpham::CountSP();
		$sotrang = ceil($a/12);
		$hientai = $_GET["trang"];
			for ($page = 1;(int)$page<=$sotrang;$page++ )
			{
				if($hientai != $page)
				{ echo "
					<a href='index.php?obj=sanpham&trang=$page'>$page</a>";
				}
				else
				{
					echo "<b>".$page."</b>";
				}
			}
		}
		
?>
</div>